package com.alibaba.mapper;

import com.alibaba.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {
    //查询所有
    @Select("select * from user")
    List<User> findAll();

    //添加用户
    @Insert("insert into user values(id,#{age},#{username},#{password},#{email},#{sex})")
    int save(User user);

    //删除用户
    void deleteByIds(Integer[] ids);

    //根据id查询用户
    @Select("select * from user where id = #{uid}")
    User findById(String uid);

    //修改用户
    @Update("update user set age = #{age}, username = #{username}, password = #{password}, email = #{email}, sex = #{sex} where id = #{id}")
    void update(User user);
}
